package file.Practice;

import java.io.File;
import java.util.Scanner;

/*
* Test03.java：要求用户在控制台输入一个目录名，然后将这个目录创建在当前项目目录下
* */
public class Mir {
    public static void main(String[] args){
        Boolean flag=true;
        do {
            System.out.print("请输入目录名:");
            String next = new Scanner(System.in).next();
            File file = new File("./src//file/" + next);
            if (file.exists()){
                System.out.println(1);
                flag=false;
            }else {
                System.out.println(2);
                file.mkdir();
            }
        }while (flag);
            System.out.print("请输入需要删除的目录名:");
            String next1 = new Scanner(System.in).next();
            File file1 = new File("./src//file/" + next1);
            if (file1.exists()){
                System.out.println(2);
                file1.delete();

            }else {
                flag=false;
                System.out.println(1);
            }


    }
}
